//
//  NativeDemoCell.m
//  JAGatherAdDemo
//
//  Created by Yc on 2022/8/25.
//

#import "NativeDemoCell.h"
#import "NativeSelfRenderAdView.h"
#import <Masonry.h>

@interface NativeDemoCell ()

@end

@implementation NativeDemoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(NativeModel *)model {
    _model = model;
    UIView *subView = (UIView *)[self.contentView viewWithTag:1000];
    if ([subView superview]) {
        [subView removeFromSuperview];
    }
    UIView *view = model.adView;
    view.tag = 1000;
    [self.contentView addSubview:view];
    [view mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];
    [model registerDataObject];
}

- (void)prepareForReuse {
    [super prepareForReuse];
    [self.model unregisterDataObject];
}

@end
